﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>培训列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
    <link href="https://cdn.bootcss.com/amazeui/2.7.2/css/amazeui.css" rel="stylesheet" />
    <link href="http://s.amazeui.org/assets/2.x/css/amaze.min.css?v=ivneioml" rel="stylesheet" />
    <link href="css/common.css" rel="stylesheet" />
    <style>
        body {
            background: #f6f6f6;
        }

        .main {
            width: 100%;
        }

        .am-list-news-default .am-list .am-list-item-desced .am-list-item-text {
            margin-top: 0.2rem;
        }

        .am-list > li {
            border-top: none;
            margin-bottom: 0.1%;
        }

        .am-list-news-default {
            margin: 0;
        }
    </style>
</head>
<body>
    <div class="page" id="page" v-cloak>

        <header data-am-widget="header" class="am-header am-header-default" style="background-color: #FFFFFF; border-bottom: 1px solid rgb(211, 211, 211);">
            <div class="am-header-left am-header-nav" onclick="goBack()">
                <a href="javascript:" class="">
                    <img class="am-header-icon-custom" src="images/veas07.png" alt="" />
                </a>
            </div>
            <h4 class="am-header-title" style=" color: black;">培训列表</h4>
            <div class="am-header-right am-header-nav"><a href="/Wap/Index.html" class="am-header-icon am-icon-home" style="color: #A9A9A9; "></a></div>
        </header>

        <form action="javascript:void(0)" class="am-form am-form-inline" style="position: relative; height:50px;">
            <div class="am-g" style="position: absolute; z-index: 1;">
                <nav data-am-widget="menu" class="am-menu  am-menu-default">
                    <a href="javascript: void(0)" class="am-menu-toggle">
                        <i class="am-menu-toggle-icon am-icon-bars"></i>
                    </a>
                    <ul class="am-menu-nav am-avg-sm-4">
                        <li class="am-parent">
                            <a href="javascript:void(0)" id="chosesport" class="" style="color:#757575;">{{sportName}}</a>
                            <ul class="am-menu-sub am-collapse  am-avg-sm-4 ">
                                <li class="am-text-center" v-for="(sport,index) in ClassType" v-on:click="change(index)">
                                    <a href="javascript:void(0)" class="">{{sport.Name}}</a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </nav>
            </div>

            <div class="am-g" style="position: absolute; z-index: 2; pointer-events: none; ">
                <div class="am-u-sm-9 am-u-sm-offset-3">
                    <div class="am-form-group am-form-icon" style="margin:8px 0 0 0;">
                        <i class="am-icon-search" style="color:#999999;"></i>
                        <input type="text" class="am-form-field" v-model="keyword" placeholder="活动名称" style=" pointer-events: auto;" />
                    </div>
                </div>
            </div>
        </form>
        <div class="am-g">
            <div data-am-widget="list_news" style="margin-bottom: 0" class="am-list-news am-list-news-default am-no-layout">
                <div class="am-list-news-bd">
                    <ul class="am-list" style="margin-bottom: 0">
                        <li v-for="venue in venueList" style="border-top:none;" class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left" v-on:click="VenueInfo(venue.Url)">
                            <div class="am-u-sm-4 am-list-thumb" v-on:click="VenueInfo(venue.gId)" style="max-height: 100px;">
                                <a :href="venue.Url">
                                    <img v-bind:src="venue.faceImg">
                                </a>
                            </div>
                            <div class=" am-u-sm-8 am-list-main" style="max-height: 100px;">
                                <div class="am-list-item-hd" style="font-size: 1.5rem;">{{venue.Name}}</div>
                                <div class="am-list-item-text">{{venue.ClassType}}</div>
                                <div class="am-list-item-text" style="color: #9a9a9a;margin-top: 5%">{{venue.org.Name}}</div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div v-if="pageinfo.pageCount>page" class="am-list-news-ft" style="padding-bottom:15px;">
                <a class="am-list-news-more am-btn am-btn-default" v-on:click="page=page+1" href="javascript:void(0)">查看更多 &raquo;</a>
            </div>
            <div v-if="pageinfo.pageCount==page" class="am-list-news-ft" style="padding-bottom:15px;color:#757575;">
                无更多数据
            </div>
        </div>
    </div>
</body>
</html>
<script src="https://use.fontawesome.com/ca6b609d64.js"></script>
<script src="https://cdn.bootcss.com/jquery/1.8.3/jquery.js"></script>
<script src="js/common.js"></script>
<script src="https://cdn.bootcss.com/vue/2.5.9/vue.js"></script>
<script src="http://cdn.amazeui.org/amazeui/2.7.2/js/amazeui.min.js"></script>

<script>
    var page = new Vue({
        el: '#page',
        data: {
            ClassType: [],
            sportName: "",
            venueList: [],
            page: 1,
            pagesize: 10,
            ClassTypeIndex: -1,
            pageinfo: {},
            keyword: ''
        },
        methods: {
            getSportType: function (index) {
                var that = this;
                $.ajax({
                    type: 'GET',
                    url: window.apiUrl + '/Api/Field/GetClassType',
                    success: function (data) {
                        if (data.errcode == 0) {
                            that.ClassType = data.data.ClassTypeList;
                            that.ClassType.unshift({ gId: "", Name: "全部" });
                            that.ClassTypeIndex = index;
                        } else {
                            alert(data.errmsg);
                        }
                    }
                })
            },
            getVenueList: function () {
                var that = this;
                that.sportName = that.ClassType[that.ClassTypeIndex].Name;
                var classkey = "";
                if (that.sportName == "全部")
                {
                    classkey = "";
                }
                else
                {
                    classkey = that.sportName;
                }
                $.ajax({
                    type: 'GET',
                    data: { page: that.page, pagesize: that.pagesize, classkey: classkey, keyword: that.keyword },
                    url: window.apiUrl + '/Api/Field/GetTrainAllList',
                    success: function (data) {
                        if (data.errcode == 0) {
                            console.log(that.page)
                            if (that.page == 1) {
                                that.venueList = data.data.activityList;
                                //console.log(that.venueList)
                            } else {
                                $(data.data.activityList).each(function () {
                                    that.venueList.push(this);
                                })
                            }
                            that.pageinfo = data.data.Page;
                        } else {
                            alert(data.errmsg);
                        }
                    }
                })
            },
            change: function (index) {
                $("#chosesport").click();
                this.ClassTypeIndex = index;
            },
            VenueInfo: function (Url) {
                location.href = Url;
            }
        },
        watch: {
            ClassTypeIndex: function () {
                this.page = 1;
                this.getVenueList();
            },
            keyword: function () {
                this.page = 1;
                this.getVenueList();
            },
            page: function () {
                this.getVenueList();
            }
        }
    })
    $(function () {
        var actid = $.getParam("sportindex");
        var keyword = $.getParam("keyword");
        if (actid == null) {
            page.getSportType(0);
        }
        else {
            page.getSportType(actid);
        }
        if (keyword != null) {
            page.keyword = keyword;
        }
    })
</script>

<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="/Content/js/wxconfig.js"></script>
<script>
    wx.ready(function () {
        wx.share("飞羽体育", "飞羽体育是一款关于订场app，主要目标人群是运动爱好者。功能包括GPS精准定位附近运动休闲娱乐场馆，为您提供方便、快捷的运动方式及参考，让你感受运动的快乐。", location.href, thisUrl + '/Wap/images/vult17.png');
    })
</script>